#!/usr/bin/env python3

def main():
    articles={}
    with open("ALLARTICLES") as allarticles:
        for line in allarticles:
            entries = line.split("\t")
            articles[entries[0]] = entries[1]

    with open("PERFECTMATCHES") as perfectmatches:
        for line in perfectmatches:
            entries = line.rstrip("\n").split("\t")
            entries.append(articles[entries[0]])
            print("\t".join(entries))
    return 0

if __name__ == "__main__":
    exit(main())
